Fix #5466: preserve text content in mixed-modality Gemini responses#5808
Closed
anuragg-saxenaa wants to merge 2 commits intospring-projects:mainfrom
Closed
Fix #5466: preserve text content in mixed-modality Gemini responses#5808anuragg-saxenaa wants to merge 2 commits intospring-projects:mainfrom
anuragg-saxenaa wants to merge 2 commits intospring-projects:mainfrom
Conversation
b248861 to
1937685
Compare
… both text and function calls When Gemini returns content with both text parts and function call parts, the responseCandidateToGeneration method now correctly preserves both instead of dropping text content when function calls are present. Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
da98a89 to
873b5bb
Compare
…nchanged when history is empty - Added early return in transform() when history is empty to avoid calling the LLM - Added unit test whenHistoryIsEmptyThenReturnQueryUnchanged() - This prevents nonsensical transformed queries from duplicate user query in history and follow-up sections Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
873b5bb to
4906312
Compare
Author
|
Closing this PR. Apologies for the noise — going forward all contributions will go through proper human review before submission. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue where GoogleGenAiChatModel drops text content when a Gemini response contains both text parts and function call parts (mixed modality).
Problem
The responseCandidateToGeneration method used an if/else branching on isFunctionCall that caused text content to be discarded when function calls were present in the response.
Solution
Combine text content and function calls into a single Generation instead of mutually exclusive branches.
Test
Added GoogleGenAiChatModelMixedContentTests with regression tests for mixed content scenarios.